import request from '../utils/request.js'
import apiConfig from '../config/api.js'

// 评论相关接口
export const commentApi = {
	// 获取评论列表
	getComments: (params = {}) => {
		return request({
			url: apiConfig.apiList.getComments,
			method: 'GET',
			params: params // 传递查询参数如page, pageSize, keyword, sightId等
		})
	},
	
	// 获取景点评论列表
	getSightComments: (sightId, params = {}) => {
		return request({
			url: apiConfig.apiList.getSightComments.replace(':sightId', sightId),
			method: 'GET',
			params: params // 传递查询参数如page, pageSize等
		})
	},
	
	// 添加评论
	addComment: (data) => {
		return request({
			url: apiConfig.apiList.addComment,
			method: 'POST',
			data: data
		})
	},
	
	
	
	// 获取评论回复列表
	getCommentReplies: (commentId, params = {}) => {
		return request({
			url: apiConfig.apiList.getCommentReplies.replace(':commentId', commentId),
			method: 'GET',
			params: params // 传递查询参数如page, pageSize等
		})
	}
}

export default commentApi